#include "widget.h"
#include "login.h"
#include <QApplication>
#include <QSqlDatabase>
#include<QSqlRecord>
#include <QElapsedTimer>
//#include "mythread.h"
//#pragma comment(lib, "ws2_32.lib")//连接库 LIBS += -lws2_32
QSqlDatabase db;
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QElapsedTimer timer;//受网络影响，连外网很慢
    timer.start();

    db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("47.115.215.143");
    db.setPort(3307);
    db.setDatabaseName("YUNMYSQL");//数据库名字
    db.setUserName("root");//账号
    db.setPassword("123456");//密码
    db.open();

    qint64 elapsedTime = timer.elapsed(); // 获取经过的时间，单位毫秒
    qDebug() << "Elapsed time:" << elapsedTime << "milliseconds";

    Widget w;
    w.show();
    //Chat *chat=new Chat(nullptr,"tutu");
    //chat->show();
    return a.exec();
    db.close();
}
